import javax.media.opengl.GL;


/**
 *
 * Classe que representa a BBox.
 */
public class BBox {
	
	private double xMin;
	private double xMax;
	private double yMin;
	private double yMax;
	
	
	/**
	 * @param xMin Coordenada x minima
	 * @param xMax Coordenada x maxima
	 * @param yMin Coordenada y minima
	 * @param yMax Coordenada y maxima
	 */
	public BBox(double xMin, double xMax, double yMin, double yMax) {
		this.xMin = xMin;
		this.xMax = xMax;
		this.yMin = yMin;
		this.yMax = yMax;
	}

	public double getxMin() {
		return xMin;
	}

	public void setxMin(double xMin) {
		this.xMin = xMin;
	}

	public double getxMax() {
		return xMax;
	}

	public void setxMax(double xMax) {
		this.xMax = xMax;
	}

	public double getyMin() {
		return yMin;
	}

	public void setyMin(double yMin) {
		this.yMin = yMin;
	}

	public double getyMax() {
		return yMax;
	}

	public void setyMax(double yMax) {
		this.yMax = yMax;
	}
	
	public void desenhar(GL gl, boolean selected) {
		gl.glColor3f(0.0f, 0.0f, 1.0f);
		gl.glLineWidth(5);
		gl.glPointSize(5);
		if (selected) {
			gl.glEnable(GL.GL_LINE_STIPPLE);
			gl.glLineStipple(1, (short) 0x00FF);		
		}
		gl.glBegin(gl.GL_LINE_LOOP);
		
		gl.glVertex2d(xMax, yMin);
		gl.glVertex2d(xMax, yMax);
		gl.glVertex2d(xMin, yMax);
		gl.glVertex2d(xMin, yMin);
		
		gl.glEnd();
		
		
		if(selected){
			gl.glDisable(GL.GL_LINE_STIPPLE);
		}
	}

}